<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

error_reporting(E_ALL);

include_once('controller/includes/constants.php');
include_once('controller/includes/db_access.php');

if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'multiple') {

    $catgorie = stripslashes($_POST['sorts']);
    $descr = stripslashes($_POST['descr']);


// Insert a new user into the `user` table  
    $q = new Query;
    $q
            ->insert_into('`toepassingen`', array(
                '`sort`' => $catgorie,
                 '`descr`' => $descr
                    )
    );

    $result = $q->run();
    $toepassing_id = $q->get_insert_id();
    if ($result && $toepassing_id > 0) {

        //$Error = '<font color="green">successful : categorie is toegevoed</font>';
               header('Location: toepassing_list.php');
    } else {

        $Error = '<font color="red">Error: toepassing is niet toegevoed</font>';
  
           
    }
}
?>
<link rel="stylesheet" href="styles/screen.css" type="text/css" charset="utf-8" media="screen" />
<table border="0" cellspacing="5" cellpadding="5">
    <thead>
        <tr>
            <th colspan="2"><h1><?php include_once('controller/includes/header.php'); ?></th>
        </tr>
        </thead>
        <tbody>
        <form name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
        <input type="hidden" name="action" value="multiple" />  
            <tr>
                <td colspan="2"><h1>toepassing add</h1><br/><br/>
                <?php if(isset($Error)){
                        echo $Error;
                    }?></td>
            </tr>
            <tr>
                <td valign="top">toepassing sort:
                </td>
                <td valign="top">
                    <input type="text" name="sorts" value="" size="20" />
                   
                </td>
            </tr>
            <tr>
                <td valign="top">beschrijving:<br />
                
                </td>
                <td valign="top">
                    <textarea name="descr" rows="4" cols="20">
                    </textarea>
                   
                </td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="save" name="save" />
                  </td>
            </tr>
          </form></tbody>
</table>

